package com.glsc.ngateway.common.base.domain.mysql.gateway.other;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.glsc.ngateway.common.api.common.utils.CommonUtils;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Author: zhaoxc
 * @Date: 2020/6/29 8:43
 * @Desc: 系统配置基础类
 */
@MappedSuperclass
public class BaseSystemConfig implements Serializable {


    private static final long serialVersionUID = -2658646288998059928L;

    //配置code
    @Column(name = "config_code", length = 100)
    protected String configCode;

    //配置name
    @Column(name = "config_name", length = 50)
    protected String configName;

    //配置value
    @Column(name = "config_value", length = 500)
    protected String configValue;

    //配置描述
    @Column(name = "description", length = 2000)
    protected String description;

    //备注信息
    @Column(name = "remark", columnDefinition = "text COMMENT '备注信息'")
    protected String remark;

    @ApiModelProperty(value = "操作人员ID")
    @Column(name = "op_operator", columnDefinition = "varchar(20) COMMENT '操作人员ID'")
    protected String opOperator;

    @ApiModelProperty(value = "操作来源")
    @Column(name = "op_source", columnDefinition = "varchar(32) COMMENT '操作来源'")
    protected String opSource;

    @ApiModelProperty(value = "操作动作(增加、修改)")
    @Column(name = "op_action", columnDefinition = "varchar(32) COMMENT '操作动作(增加、修改)'")
    protected String opAction;

    @ApiModelProperty(value = "操作时间 yyyy-MM-dd HH:mm:ss")
    @Column(name = "op_time", columnDefinition = "datetime comment '操作时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime opTime;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getConfigCode() {
        return configCode;
    }

    public void setConfigCode(String configCode) {
        this.configCode = configCode;
    }

    public String getConfigName() {
        return configName;
    }

    public void setConfigName(String configName) {
        this.configName = configName;
    }

    public String getConfigValue() {
        return configValue;
    }

    public void setConfigValue(String configValue) {
        this.configValue = configValue;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getOpOperator() {
        return opOperator;
    }

    public void setOpOperator(String opOperator) {
        this.opOperator = opOperator;
    }

    public String getOpSource() {
        return opSource;
    }

    public void setOpSource(String opSource) {
        this.opSource = opSource;
    }

    public String getOpAction() {
        return opAction;
    }

    public void setOpAction(String opAction) {
        this.opAction = opAction;
    }

    public LocalDateTime getOpTime() {
        return opTime;
    }

    public void setOpTime(LocalDateTime opTime) {
        this.opTime = opTime;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public String toString() {
        return this.getClass().getSimpleName() + "{" + CommonUtils.getFiledString(this) + "}";
    }
}
